package com.drinkian.business.comment.controller;

import com.drinkian.business.comment.entity.po.Comment;
import com.drinkian.business.comment.service.ICommentService;
import com.drinkian.entity.RequestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("comment")
public class CommentController {

    @Autowired
    private ICommentService iCommentService;

    @GetMapping("getCommentListByItemId")
    public RequestResult getCommentListByItemId(@RequestParam("itemId")Long itemId){
        return iCommentService.getCommentListByItemId(itemId);
    }

    @PostMapping("publish")
    public RequestResult publish(@RequestBody Comment comment) {
        return iCommentService.publish(comment);
    }

    @PostMapping("updateCommentById")
    public RequestResult updateCommentById(@RequestBody Comment comment) {
        return iCommentService.updateCommentById(comment);
    }
}
